package cn.darksoul3.thinking.in.spring.bean.definition;

import cn.darksoul3.thinking.in.spring.ioc.overview.domain.User;
import org.springframework.beans.MutablePropertyValues;
import org.springframework.beans.factory.config.BeanDefinition;
import org.springframework.beans.factory.support.BeanDefinitionBuilder;
import org.springframework.beans.factory.support.GenericBeanDefinition;

/**
 * {@link org.springframework.beans.factory.config.BeanDefinition}
 */
public class BeanDefinitionCreationDemo {

    public static void main(String[] args) {

        BeanDefinitionBuilder definitionBuilder = BeanDefinitionBuilder.genericBeanDefinition(User.class);
        definitionBuilder.addPropertyValue("age", 24).addPropertyValue("name", "rick");
        BeanDefinition beanDefinition = definitionBuilder.getBeanDefinition();

        GenericBeanDefinition genericBeanDefinition = new GenericBeanDefinition();
        genericBeanDefinition.setBeanClass(User.class);
        MutablePropertyValues propertyValues = new MutablePropertyValues();
        propertyValues.add("age", 24).add("name", "rick");
        genericBeanDefinition.setPropertyValues(propertyValues);

    }

}
